package com.shop.loan.model;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.Setter;
import xyz.erupt.annotation.Erupt;
import xyz.erupt.annotation.EruptField;
import xyz.erupt.annotation.sub_field.Edit;
import xyz.erupt.annotation.sub_field.EditType;
import xyz.erupt.annotation.sub_field.View;
import xyz.erupt.annotation.sub_field.sub_edit.AttachmentType;
import xyz.erupt.annotation.sub_field.sub_edit.ChoiceType;
import xyz.erupt.annotation.sub_field.sub_edit.VL;
import xyz.erupt.upms.model.base.HyperModel;

import javax.persistence.*;

@Entity
@Table(name = "s_user_identity")
@Erupt(
        name = "用户身份信息",
        authVerify = false
)
@ApiModel("用户身份信息")
@Getter
@Setter
public class UserIdentity extends HyperModel {

    @Column(name = "rental_user_id")
    private Long rentalUserId;


    @EruptField(
            views = @View(title = "姓名"),
            edit = @Edit(title = "姓名")
    )
    @ApiModelProperty(name = "idCardName", value = "姓名", dataType = "1", example = "1")
    private String idCardName;

    @EruptField(
            views = @View(title = "身份证号码"),
            edit = @Edit(title = "身份证号码")
    )
    @ApiModelProperty(name = "idCardNumber", value = "身份证号码", dataType = "1", example = "1")
    private String idCardNumber;

    @EruptField(
            views = @View(title = "身份证正面照片"),
            edit = @Edit(title = "身份证正面照片",
                    notNull = true,
                    type = EditType.ATTACHMENT,
                    attachmentType = @AttachmentType(type = AttachmentType.Type.IMAGE))
    )
    @ApiModelProperty(name = "idCardPicFront", value = "身份证正面照片", dataType = "1", example = "1")
    private String idCardPicFront;

    @EruptField(
            views = @View(title = "身份证反面照片"),
            edit = @Edit(title = "身份证反面照片",
                    notNull = true,
                    type = EditType.ATTACHMENT,
                    attachmentType = @AttachmentType(type = AttachmentType.Type.IMAGE))
    )
    @ApiModelProperty(name = "idCardPicBack", value = "身份证反面照片", dataType = "1", example = "1")
    private String idCardPicBack;


    @EruptField(
            views = @View(title = "居住地址"),
            edit = @Edit(
                    title = "居住地址"
            )
    )
    private String homeAddress;

    @EruptField(
            views = @View(title = "居住状况"),
            edit = @Edit(
                    title = "居住状况",
                    type = EditType.CHOICE,
                    choiceType = @ChoiceType(
                            vl = {
                                    @VL(label = "自置", value = "1"),
                                    @VL(label = "按揭", value = "2"),
                                    @VL(label = "亲属楼宇", value = "3"),
                                    @VL(label = "集体宿舍", value = "4"),
                                    @VL(label = "租房", value = "5"),
                                    @VL(label = "共有住宅", value = "6"),
                                    @VL(label = "借住", value = "12"),
                                    @VL(label = "未知", value = "9"),
                            }
                    ))
    )
    private Integer resiStatus;

    @EruptField(
            views = @View(title = "居住地邮编"),
            edit = @Edit(
                    title = "居住地邮编"
            )
    )
    private String resiPc;

    @EruptField(
            views = @View(title = "性别"),
            edit = @Edit(
                    title = "性别",
                    type = EditType.CHOICE,
                    choiceType = @ChoiceType(
                            vl = {
                                    @VL(label = "男性", value = "1"),
                                    @VL(label = "女性", value = "2"),
                            }
                    ))
    )
    private Integer ocrSex;

    @EruptField(
            views = @View(title = "民族"),
            edit = @Edit(
                    title = "民族"
            )
    )
    private String ocrNation;

    @EruptField(
            views = @View(title = "身份证地址"),
            edit = @Edit(
                    title = "身份证地址"
            )
    )
    private String ocrAddress;

    @EruptField(
            views = @View(title = "发证机关"),
            edit = @Edit(
                    title = "发证机关"
            )
    )
    private String ocrIssueOrg;


    @EruptField(
            views = @View(title = "身份证有效期开始日期"),
            edit = @Edit(
                    title = "身份证有效期开始日期"
            )
    )
    private String ocrStartValidDate;

    @EruptField(
            views = @View(title = "身份证有效期结束日期"),
            edit = @Edit(
                    title = "身份证有效期结束日期"
            )
    )
    private String ocrEndValidDate;
}
